﻿package mortal.game.view.platform
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;

    public class PlatformShowGirlModule extends BaseWindow
    {
        private var _bg:GImageBitmap;
        private var _girl:GImageBitmap;
        private var _rechargeBtn:GLoadingButton;
        private var _rechargeTxt:GTextFiled;
        private var _qqTxt:GTextFiled;
        public static var platformData:PlatformShowGirlShowData;

        public function PlatformShowGirlModule()
        {
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            if (this._bg)
            {
                this._bg.dispose(param1);
                this._bg = null;
            }
            if (this._girl)
            {
                this._girl.dispose(param1);
                this._girl = null;
            }
            if (this._rechargeBtn)
            {
                this._rechargeBtn.dispose(param1);
                this._rechargeBtn = null;
            }
            if (this._rechargeTxt)
            {
                this._rechargeTxt.dispose(param1);
                this._rechargeTxt = null;
            }
            if (this._qqTxt)
            {
                this._qqTxt.dispose(param1);
                this._qqTxt = null;
            }
            super.disposeImpl(param1);
            return;
        }// end function

        protected function onClickHandle(event:MouseEvent) : void
        {
            if (event.target == this._rechargeBtn)
            {
                GameUtil.gotoRecharge(ModuleTypeConst.PlatformShowGirl);
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            if (platformData)
            {
                setSize(platformData.size.x, platformData.size.y);
                title = platformData.title;
                this._bg = UIFactory.gImageBitmap(platformData.bgResName, platformData.bgPos.x, platformData.bgPos.y, this);
                this._girl = UIFactory.gImageBitmap(platformData.girlResName, platformData.girlPos.x, platformData.girlPos.y, this);
                this._rechargeBtn = UIFactory.gLoadingButton(platformData.rechargeBtnName, platformData.rechargeBtnPos.x, platformData.rechargeBtnPos.y, platformData.rechargeBtnSize.x, platformData.rechargeBtnSize.y, this);
                this._rechargeBtn.configEventListener(MouseEvent.CLICK, this.onClickHandle);
                this._rechargeTxt = UIFactory.gTextField(String(ParamsConst.instance.showGirlRechargeAmount), platformData.rechargeTxtPos.x, platformData.rechargeTxtPos.y, 300, 20, this, GlobalStyle.textFormatLv.center(), true);
                this._qqTxt = UIFactory.gTextField("*******", platformData.qqTxtPos.x, platformData.qqTxtPos.y, 320, 20, this, null, true);
            }
            this.updateShow();
            return;
        }// end function

        public function updateShow() : void
        {
            if (Cache.instance.vip.reChargeMoney >= ParamsConst.instance.showGirlRechargeAmount)
            {
                this._qqTxt.text = ParamsConst.instance.showGirlQQ;
            }
            return;
        }// end function

    }
}
